<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="root"></div>
</body>

</html>
<script src="https://unpkg.com/vue@next"></script>
<script>
    // mixin 混入
    // 组件 data  methods 优先级高于mixin data  methods  优先级
    // 生命周期函数 先执行mixin里面的,再执行组件里面的
    // 自定义的属性 组件中的属性优先级高于mixin属性的优先级
    const myMixin={
        number:1
    }
    const app = Vue.createApp({
        mixins:[myMixin],
        number:2,
        template: `
        <div>
            <div>{{this.$options.number}}</div>
        </div>
        `
    })
    app.config.optionMergeStrategies.number=(mixinVal,appValue)=>{
        return mixinVal || appValue
    }
    const vm = app.mount('#root')
</script>